<?php
class Person{
    // 成员属性
    private $name;
    protected $age;
    public function __construct($name, $age)
    {
        // 自动调用
        $this->name = $name;
        $this->age = $age;
    }
    // 成员方法
    protected function eat($food = 'rice') {
        echo $this->name . ' is eating ' . $food;
    }

    public function printName() {
        echo '姓名：' . $this->name . '<br/>';
    }

    public function printAge() {
        echo '年龄：' . $this->age . '<br>';
    }

    public function printInfo() {
        $this->printName();
        $this->printAge();
    }
}

